package com.nononsenseapps.feeder.net

import android.content.Context
import android.content.Intent
import android.os.Build

object RssServer {
    var mService:Intent?=null

     fun start(app:Context){
         mService = Intent(app, HttpService::class.java)
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             app.startForegroundService(mService)
         }else {
             app.startService(mService)
         }
     }

    fun stop(app:Context){
        mService?.let { app.stopService(it) }
        mService =null
    }

    fun isRssServerRunning():Boolean{
        return mService != null
    }


    fun getOpmlExportAddr(context: Context): String = getRunAddr(context) + OPML_EXPORT_PATH
}
